#pragma once
#include <opencv2/opencv.hpp>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <ostream>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <fstream>
#include <numeric>
#include <algorithm>
#include <opencv2/dnn/dnn.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include "hbmodel_error_code.h"
#include "hbmodel_struct.h"
#include "model_manager.h"
#include "common/base_struct.h"

class LogInfo;

namespace ai {

class ModelConfig;
class HBPredictor;
class HBClsPredictor;
class HBOCRRecognizer;
class HBOCRDetector;
class HBDetPredictor;
class HBDetYolov8Predictor;
class HBSegPredictor;
class HBOCRPostProcessor;

class HBModelManager: public ai::ModelManager
{
public:
    HBModelManager(LogInfo *log_info);
    ~HBModelManager();

    int init_model_imp(std::string model_path, std::string cfg_path, int gpu_idx, ai::InitModelData &imd, BasePredictor** infer, int debug_mode);

    int free_model(int md_idx);


private:
    int load_model(std::string model_path, ai::HBPackPredictor* hbp, std::string model_id);


private:
    // friend class ClsPredictor;
    // friend class OCRRecognizer;
    // friend class OCRDetector;
    friend class HBDetPredictor;
    // friend class SegPredictor;

    // en::Chip_verifi *chip;
	// std::mutex rec_mut;

};

} // namespace hb
